package codeTop;

public class q198 {
    public int rob(int[] nums) {
        int dp1 = 0;
        int dp2 = 0;
        for (int i = 0; i < nums.length; i++) {
            int temp = dp2+nums[i];
            dp2 = Math.max(dp1,dp2);
            dp1 = temp;
        }
        return Math.max(dp1,dp2);
    }
}
